/**
 * Created by win 10 on 1/31/2018.
 */
$(function () {
    var data = [
        ['成都市', 234],
        ['绵阳市', 112],
        ['德阳市', 89],
        ['南充市', 66],
        ['自贡市', 55],
        ['内江市', 67],
        ['宜宾市', 87],
        ['泸州市', 17],
        ['广元市', 55],
        ['巴中市', 34],
        ['广安市', 45],
        ['达州市', 15],
        ['乐山市', 10],
        ['眉山市', 14],
        ['资阳市', 65],
        ['雅安市', 34],
        ['遂宁市', 23],
        ['攀枝花', 43],
        ['阿坝藏族羌族自治州', 34],
        ['甘孜藏族自治州', 34],
        ['凉山彝族自治州', 45]
    ];
    $.getJSON('https://data.jianshukeji.com/jsonp?filename=geochina/sichuan.json&callback=?', function (geojson) {
        Highcharts.mapChart('container', {
            title: {
                text: ''
            },
            mapNavigation: {
                enabled: true,
                buttonOptions: {
                    verticalAlign: 'bottom'
                }
            },
            colorAxis: {
                tickPixelInterval: 100
            },
            credits: {
                enabled:false
            },
            series: [{
                data: data,
                mapData: geojson,
                joinBy: 'fullname',
                keys: ['fullname', 'value'],
                name: '投资项目数',
                states: {
                    hover: {
                        color: '#a4edba'
                    }
                },
                dataLabels: {
                    enabled: true,
                    format: '{point.properties.postal}'
                }
            }]
        });
    });

    $('#custodian').highcharts({
        chart: {
            type: 'area'
        },
        title: {
            text: '四川区私募基金登记备案趋势',
            style: {
                color: '#323232'
            }
        },
        subtitle: {
            text: '' +
            ''
        },
        xAxis: {
            allowDecimals: false,
            labels: {
                formatter: function () {
                    return this.value; // clean, unformatted number for year
                }
            }
        },
        yAxis: {
            title: {
                text: '数量',
                style: {
                    color: "#323232"
                }
            },
            labels: {
                formatter: function () {
                    return this.value;
                }
            }
        },
        legend: {
            itemStyle: {
                color: "#323232"
            },
            itemHoverStyle: {
                color: "#000000"
            }
        },
        credits: {
            enabled:false
        },
        tooltip: {
            pointFormat: '{series.name}<b>{point.y:,.0f}</b>'
        },
        plotOptions: {
            area: {
                pointStart: 2013,
                marker: {
                    enabled: false,
                    symbol: 'circle',
                    radius: 5,
                    states: {
                        hover: {
                            enabled: true
                        }
                    }
                }
            }
        },
        series: [{
            name: '私募管理人登记',
            data: [
                26, 60, 78, 86, 88, 100]
        }, {
            name: '私募基金产品备案',
            data: [
                27, 46, 56, 85, 123, 135]
        }]
    });
    $(".submission-item > a").click(function (e) {
        if (!$.cookie('FUND_USER_TOKEN')) {
            e = window.event || event;
            e.preventDefault();
            $(".bg-model").css("display", "block");
            $(".model-container").css("display", "block");
        }
    })
})